package prv.pursuivant.core.impl;

import prv.pursuivant.core.Toon;

/**
 * 
 * Simple class representing one toon.
 * 
 * @author Kwinto
 * 
 */
public class ToonImpl implements Toon {

	/**
	 * Name of the toon
	 */
	private final String name;

	/**
	 * Rank in guild - for sorting purposes
	 */
	private final Integer rank;

	/**
	 * Is character active for processing?
	 */
	private Boolean active;

	/**
	 * The only constructor. This is very simple class
	 * 
	 * @param name
	 *            name of the toon
	 * 
	 * @param rank
	 *            rank in the guild - for sorting and quick
	 *            selecting/deselecting
	 */
	public ToonImpl(String name, Integer rank) {
		this.name = name;
		this.rank = rank;
		this.active = true;
	}

	/**
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (obj instanceof ToonImpl) {
			ToonImpl toon = (ToonImpl) obj;
			return this.name.equals(toon.name);
		}
		return false;
	}

	/**
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		return this.name.hashCode();
	}

	/**
	 * @return the active
	 */
	public Boolean isActive() {
		return this.active;
	}

	/**
	 * @param active
	 *            the active to set
	 */
	public void setActive(Boolean active) {
		this.active = active;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return this.name;
	}

	/**
	 * @return the rank
	 */
	public Integer getRank() {
		return this.rank;
	}

}
